-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pickers] Replace the onOpen()
and onClose()
methods of usePickerContext()
with a single setOpen()
method
#15701
[pickers] Replace the onOpen()
and onClose()
methods of usePickerContext()
with a single setOpen()
method
#15701
Conversation
onToggleOpening
to the picker public contextonToggleOpening
to usePickerContext()
Deploy preview: https://deploy-preview-15701--material-ui-x.netlify.app/ Updated pages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we were discussing this exact topic when we were initially introducing the other methods. 😃
I can't think of any harm providing it, if we already feel that it is cleaner in most regular cases. 👌
packages/x-date-pickers/src/internals/components/PickerProvider.tsx
Outdated
Show resolved
Hide resolved
Yes, we were debating between an |
onToggleOpening
to usePickerContext()
onOpen()
and onClose()
methods of usePickerContext()
with a single setOpen()
method.
4680590
to
080521d
Compare
080521d
to
c0e4ced
Compare
@@ -8,7 +8,7 @@ export interface OpenStateProps { | |||
|
|||
export const useOpenState = ({ open, onOpen, onClose }: OpenStateProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No behavior change, I just aligned the wording a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice final result, great job! 👍 💯
I think such cleaner type of API should be sufficient enough and will avoid "analysis-paralysis" (what do I use now... 🤔)😆
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.types.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.types.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerValue.types.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…rValue.types.ts Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…rValue.types.ts Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…rValue.types.ts Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
onOpen()
and onClose()
methods of usePickerContext()
with a single setOpen()
method.onOpen()
and onClose()
methods of usePickerContext()
with a single setOpen()
method
While working on #15671, I started to duplicate a lot the
handleTogglePicker
method.Changelog
Breaking changes
onOpen
andonClose
methods of theusePickerContext()
hook have been replaced with a singlesetOpen
method — Learn more.